package tests.httpunit;

import java.io.IOException;
import java.net.MalformedURLException;

import org.xml.sax.SAXException;

import com.meterware.httpunit.GetMethodWebRequest;
import com.meterware.httpunit.WebConversation;
import com.meterware.httpunit.WebRequest;
import com.meterware.httpunit.WebResponse;
import com.meterware.httpunit.WebTable;

import junit.framework.TestCase;

public class HttpUnitTests extends TestCase {

	private String BASE_URL="http://localhost:8080/people";
	
	protected void setUp() throws Exception {
		super.setUp();
	}

	protected void tearDown() throws Exception {
		super.tearDown();
	}

	public void testCheckForPeopleTable() throws MalformedURLException, IOException, SAXException {
		WebConversation wc = new WebConversation();
	    WebRequest     req = new GetMethodWebRequest(BASE_URL);
	    WebResponse   resp = wc.getResponse( req );
	    assertTrue("There should be a response", null != resp);
	    WebTable pt = resp.getTableWithID("peopleTable");
	    assertTrue("There should be at least two rows!", pt.getRowCount() >= 2);
	}
	
	
}
